import request from "@/utils/request";

//设备管理页面 getVmlist
export function getVmList(pageIndex,pageSize,innerCode) {
  return request({
    url: `/vm-service/vm/search`,
    method: 'get',
    params: {
      pageIndex,pageSize,innerCode
    },
    contentType : "application/x-www-form-urlencoded; charset=utf-8"
  })
}
//策略选项
export function getPolicyList() {
  return request({
    url: `/vm-service/policy`,
    method: 'get',
  })
}
//设置优惠策略
export function setPolicy(data) {
  return request({
    url: `/vm-service/vm/applyPolicy`,
    method: 'put',
    data
  })
}
//获得vmtype选项
export function getvmtypeList(pageIndex,pageSize) {
  return request({
    url: `vm-service/vmType/search`,
    method: 'get',
    params: {
      pageIndex:1,pageSize:1000
    }
  })
}
export function getvmtype(pageIndex,pageSize,name) {
  return request({
    url: `vm-service/vmType/search`,
    method: 'get',
    params: {
      pageIndex,pageSize,name
    },
    contentType : "application/x-www-form-urlencoded; charset=utf-8"
  })
}
//获得node选项
export function getNodeList(pageIndex,pageSize) {
  return request({
    url: `vm-service/node/search`,
    method: 'get',
    params: {
      pageIndex:1,pageSize:1000
    }
  })
}

//新建设备
export function addVm(data) {
  return request({
    url: `vm-service/vm`,
    method: 'post',
    data
  })
}
//获取策略详情
export function getpolicydetails(innerCode) {
  return request({
    url: `vm-service/policy/vmPolicy/${innerCode}`,
    method: 'get',
  })
}
//取消策略
export function cancelPolicy(code,id) {
  return request({
    url: `vm-service/vm/cancelPolicy/${code}/${id}`,
    method: 'put',
  })
}
//获得区域名字
export function getregionname(regionId) {
  return request({
    url: `vm-service/region/${regionId}`,
    method: 'get',
  })
}
//修改设备
export function changeVm(id1,id2) {
  return request({
    url: `vm-service/vm/${id1}/${id2}`,
    method: 'put'
  })
}
//获得设备信息
export function getVmMsg(typeid) {
  return request({
    url: `vm-service/vmType/${typeid}`,
    method: 'get',
  })
}
//获得商品信息列表
export function getchannelList(innerCode) {
  return request({
    url: `vm-service/channel/channelList/${innerCode}`,
    method: 'get',
  })
}
//获得销售量
export function getShowNum(start,end,innerCode) {//2023-04-26+23:59:59
  return request({
    url: `order-service/report/orderCount`,
    method: 'get',
    params: {
      start,end,innerCode
    }
  })
}
//获得销售额
export function getShowMoney(start,end,innerCode) {//2023-04-26+23:59:59
  return request({
    url: `order-service/report/orderAmount`,
    method: 'get',
    params: {
      start,end,innerCode
    }
  })
}
//获得补货次数
export function getAddNum(innerCode,start1,end1) {
  return request({
    url: `task-service/task/supplyCount/${innerCode}/${start1}/${end1}`,
    method: 'get',
  })
}
//获得维修次数
export function getRepairNum(innerCode,start1,end1) {//2023-04-26
  return request({
    url: `task-service/task/repairCount/${innerCode}/${start1}/${end1}`,
    method: 'get',
  })
}
//获得skuCollect
export function getSkuCollect(innerCode,start1,end1) {//2023-04-26
  return request({
    url: `order-service/report/skuCollect/${innerCode}/${start1}/${end1}`,
    method: 'get',
  })
}
//新建设备类型
export function uploadVmType(data) { 
  return request({
    url: 'vm-service/vmType',
    method: 'post',
    data,
  })
}
export function uploadimage(data) { 
  return request({
    url: 'vm-service/sku/fileUpload',
    method: 'post',
    data,
  })
}

//修改设备类型
export function changeVmType(data,typeId) { 
  return request({
    url: `vm-service/vmType/${typeId}`,
    method: 'put',
    data,
  })
}

//vm-service/sku/search 选择商品的dialog
export function getChooseList(pageIndex,pageSize,skuName) {
  return request({
    url: `vm-service/sku/search`,
    method: 'get',
    params: {
      pageIndex,pageSize,skuName
    }
  })
}
//删除合作商
export function delPartner(id) {
  return request({
    url: `user-service/partner/${id}`,
    method: 'delete',
  })
}
//删除设备类型
export function delVm(typeId) {
  return request({
    url: `vm-service/vmType/${typeId}`,
    method: 'delete',
  })
}

//获得商圈类型
export function businessType(id) { 
  return request({
    url: `vm-service/businessType/name/${id}`,
    method: 'get',
  })
}
//获得该商圈top10
export function businessTop10(id) { 
  return request({
    url: `vm-service/sku/businessTop10/${id}`,
    method: 'get',
  })
}

//修改货道商品
export function channelConfig(data) { 
  return request({
    url: 'vm-service/channel/channelConfig',
    method: 'put',
    data
  })
}